package demo.access.modifier;

public class StaticClass {
	public static void main(String[] args) {
//		StaticCodeExample.print();
		StaticCodeExample st1 = new StaticCodeExample();
		StaticCodeExample st2 = new StaticCodeExample();
		st1.increase();
		st2.increase();
		st1.print();
		st2.print();
		System.out.println("main: " + StaticCodeExample.counter);
	}
}

class StaticCodeExample {
	static int counter = 0;
	static {
		counter++;
		System.out.println("Static Code block: counter: " + counter);
	}

	StaticCodeExample() {
		System.out.println("Constructor: counter: " + counter);
	}

	static {
		System.out.println("This is another static block");
	}
	
	public void print()
	{
		System.out.println(counter);
	}
	
	public void increase()
	{
		counter++;
	}
}
